package com.fqgj.xjd.user.client.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/3/3
 * Time: 下午12:00
 */
public enum UserSalaryEnum {
    UNDER_5000(1, "Below ₹5,000"),
    BETWEEN_5000_AND_9999(2, "₹5,000-₹9,999"),
    BETWEEN_10000_AND_14999(3, "₹10,000-₹14,999"),
    BETWEEN_15000_AND_29999(4, "₹15,000-₹29,999"),
    BETWEEN_30000_AND_49999(5, "₹30,000-₹49,999"),
    MORE_THAN_50000(6, "Above ₹50,000");

    private Integer type;
    private String desc;

    UserSalaryEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public UserSalaryEnum setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public UserSalaryEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static List<String> getDescList() {
        List<String> list = new ArrayList<>();
        for (UserSalaryEnum enumObj : UserSalaryEnum.values()) {
            list.add(enumObj.getDesc());
        }
        return list;
    }

    public static UserSalaryEnum getEnumByType(Integer type) {
        UserSalaryEnum userSalaryEnum = null;
        for (UserSalaryEnum enumObj : UserSalaryEnum.values()) {
            if (enumObj.getType().equals(type)) {
                userSalaryEnum = enumObj;
                break;
            }
        }
        return userSalaryEnum;
    }

    public static UserSalaryEnum getEnumByDesc(String desc) {
        UserSalaryEnum userSalaryEnum = null;
        for (UserSalaryEnum enumObj : UserSalaryEnum.values()) {
            if (enumObj.getDesc().equals(desc)) {
                userSalaryEnum = enumObj;
                break;
            }
        }
        return userSalaryEnum;
    }
}
